package com.cyd.springboot03demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

@SpringBootApplication
public class Springboot03DemoApplication {

    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(Springboot03DemoApplication.class);
        ConfigurableApplicationContext context = application.run(args);
        // 项目启动完成后输出
        System.out.println("--------------项目启动了---------------");
        // 通过容器获得系统属性
        ConfigurableEnvironment environment = context.getEnvironment();
        String port = environment.getProperty("server.port");
        System.out.println("http://localhost:" + port + "/hello/h");
    }

}
